import 'dart:convert'  show json;

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhrs/api/api.dart' ;
import 'package:zhrs/mainpage/mainindex.dart';
import 'package:zhrs/mainpage/webviewpage.dart';

alertDialog(BuildContext context,String msg){
  showDialog<Null>(
    context: context,

    barrierDismissible: false,
    child: new AlertDialog(
      title: new Text(
        '温馨提示',
        style: new TextStyle(
          color: Colors.black54,
          fontSize: 18.0,
        ),
      ),
      content: new Text(msg),
      actions: <Widget>[
        new FlatButton(
            onPressed: () {
              Navigator.pop(context);
            },
            child: new Text('确定')),
      ],
    ),
  );
}

void showCupertinoDialogs(BuildContext context,String msg) {
  var dialog = CupertinoAlertDialog(
    content:
    Column(

    children: <Widget>[
      Text(
        "提示",
        style: TextStyle(fontSize: 20),
      ),
      Container(
        height: 9,
      ),
      Text(
        msg,
        style: TextStyle(fontSize: 15),
      ),
    ],
    ),

    actions: <Widget>[
      Container(
        child:  CupertinoButton(
           padding: EdgeInsets.all(0),
         minSize: 40,
         child: Text("确定"),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
  ),
    ],
  );
  showDialog(context: context, builder: (_) => dialog);
}
void confirmCupertinoDialogs(BuildContext context,String msg) {
  var dialog = CupertinoAlertDialog(
    content: Text(
      msg,
      style: TextStyle(fontSize: 20),
    ),
    actions: <Widget>[
      Container(
        child:  CupertinoButton(
          padding: EdgeInsets.all(0),
          minSize: 40,
          child: Text("确定"),
          onPressed: () async {

         await Webviewpage.controller.evaluateJavascript("clearLocalStorage()");
         HttpManager.logout(context);

          },
        ),
      ),
      Container(
        child:  CupertinoButton(
          padding: EdgeInsets.all(0),
          minSize: 40,
          child: Text("取消"),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
      ),
    ],
  );
  showDialog(context: context, builder: (_) => dialog);
}
///岗位推荐
class recommendationmessage {
  recommendationmessage({
    this.title,
    this.imageUrl,
    this.description,
    this.Url
  });
  final String title;
  final String imageUrl;
  final String description;
  final String Url;

  recommendationmessage.fromJson(Map json):
  title=json["title"]
  ,imageUrl=json["imageUrl"]
  ,description=json["description"],
  Url=json["Url"];

  Map toJson()=>{"title":title,"imageUrl":imageUrl,"description":description};
  bool selected = false;
}

///男
final List<recommendationmessage> recommendationmessagesman = [
  recommendationmessage(
    title: '上海万达高薪诚聘技术人员',
    description: "[就业信息]                                        2019-11-7",
    imageUrl: 'http://106.12.180.103/smartDemo/images/news-img1.png',

  ),
  recommendationmessage(
    title: '上海社区人员报考职位推荐',
    description: "[就业信息]                                        2019-11-7",
    imageUrl: 'http://106.12.180.103/smartDemo/images/news-img2.png',

  ),
];

///女
final List<recommendationmessage> recommendationmessageswoman = [
  recommendationmessage(
    title: '现如今的生育政策下那些孕检是免费的？好清楚又能节省',
    description: "[政策]                                        2019-11-7",
    imageUrl: 'http://106.12.180.103/smartDemo/images/news-img3.png',

  ),
  recommendationmessage(
    title: '2019年二胎生育保险报销新标准,你都了解了吗？',
    description: "[就业信息]                                        2019-11-7",
    imageUrl: 'http://106.12.180.103/smartDemo/images/news-img4.png',

  ),
];

///老

final List<recommendationmessage> recommendationmessagesold = [
  recommendationmessage(
    title: '2019年养老保险政策新变革,将会有这三种改变!',
    description: "[政策]                                        2019-11-7",
    imageUrl: 'http://106.12.180.103/smartDemo/images/news-img5.png',

  ),
  recommendationmessage(
    title: '2019年企业离退休人员养老金资格认证工作开始啦',
    description: "[政策]                                        2019-11-7",
    imageUrl: 'http://106.12.180.103/smartDemo/images/news-img6.png',

  ),
];


///我的应用
class applicationfunctions {
  applicationfunctions({
    this.index,
    this.imageUrl,
    this.description,
    this.color,
    this.url,
  });



  final String imageUrl;
  final String description;
  final int index;
  final Color color;
  final String url;
  applicationfunctions.fromJson(Map json):
      index=json["index"],
  imageUrl=json["imageUrl"]
  ,description=json["description"],
  color=json["color"],
        url=json["url"];

  Map toJson()=>{"index":index,"imageUrl":imageUrl,"description":description,"color":color,"url":url};
  bool selected = false;
}

///男
final List<applicationfunctions> applicationfunctionssman = [
  applicationfunctions(
      index: 0,
      description: "电子社保卡",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-1.png',
      color:Colors.lightBlueAccent,
      url:"https://www.dzsbk.cn/smartDemo/page/main/dzsbk_jbxxqr_01.html"
  ),
  applicationfunctions(
      index: 1,
      description: "我的人设N年",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-2.png',
      color:Colors.redAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/rsnn1.html"
  ),
  applicationfunctions(
      index: 2,
      description: "职业资格查询",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-3.png',
      color:Colors.yellow
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/zyzgcx_01.html"
  ),
  applicationfunctions(
      index: 3,
      description: "创业贷款",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-4.png',
      color:Colors.green
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/cydk_01.html"
  ),
  applicationfunctions(
      index: 4,
      description: "在就业政策",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-5.png',
      color:Colors.purpleAccent

  ),
  applicationfunctions(
      index: 5,
      description: "购房补贴",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-6.png',
      color:Colors.pinkAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/sqgfbt_grxxcx_01.html"
  ),
  applicationfunctions(
      index: 6,
      description: "就业D图",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-7.png',
      color:Colors.lightBlueAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/jydt_rlzyfw_01.html"
  ),
  applicationfunctions(
      index: 7,
      description: "更多",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-8.png',
      color:Colors.redAccent

  ),
];

///女
final List<applicationfunctions> applicationfunctionsswoman = [
  applicationfunctions(
      index: 0,
      description: "电子社保卡",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-1.png',
      color:Colors.lightBlueAccent,
      url:"https://www.dzsbk.cn/smartDemo/page/main/dzsbk_jbxxqr_01.html"

  ),
  applicationfunctions(
      index: 1,
      description: "我的人设N年",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-2.png',
      color:Colors.redAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/rsnn2.html"
  ),
  applicationfunctions(
      index: 2,
      description: "生育保险申请",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-3b.png',
      color:Colors.yellow
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/sybxsq.html"
  ),
  applicationfunctions(
      index: 3,
      description: "少儿居保缴费",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-4.png',
      color:Colors.green
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/sejbjf_01.html"
  ),
  applicationfunctions(
      index: 4,
      description: "养老基金预测",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-5b.png',
      color:Colors.purpleAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/yljcs_01.html"
  ),
  applicationfunctions(
      index: 5,
      description: "购房补贴",
      imageUrl: 'http://106.12.180.103/smartDemo/images/gfbt.png',
      color:Colors.pinkAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/sqgfbt_grxxcx_01.html"
  ),
  applicationfunctions(
      index: 6,
      description: "就业D图",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-7.png',
      color:Colors.lightBlueAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/jydt_rlzyfw_01.html"
  ),
  applicationfunctions(
      index: 7,
      description: "更多",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-8.png',
      color:Colors.redAccent
  ),
];

///老

final List<applicationfunctions> applicationfunctionssold = [
  applicationfunctions(
      index: 0,
      description: "电子社保卡",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-1.png',
      color:Colors.lightBlueAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/dzsbk_jbxxqr_01.html"
  ),
  applicationfunctions(
      index: 1,
      description: "我的人设N年",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-2.png',
      color:Colors.redAccent
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/rsnn3.html"
  ),
  applicationfunctions(
      index: 2,
      description: "预约挂号",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-3c.png',
      color:Colors.yellow
      ,url:"https://www.dzsbk.cn/smartDemo/page/medicare/yygh_xyy_01.html"
  ),
  applicationfunctions(
      index: 3,
      description: "养老认证",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-4c.png',
      color:Colors.green
      ,url:"https://www.dzsbk.cn/smartDemo/page/main/ylrz_01.html"
  ),
  applicationfunctions(
      index: 4,
      description: "养老保险",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-5c.png',
      color:Colors.purpleAccent

  ),
  applicationfunctions(
      index: 5,
      description: "医疗保险",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-6c.png',
      color:Colors.yellowAccent

  ),
  applicationfunctions(
      index: 6,
      description: "办事指南",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-7c.png',
      color:Colors.lightBlueAccent

  ),
  applicationfunctions(
      index: 7,
      description: "更多",
      imageUrl: 'http://106.12.180.103/smartDemo/images/icon-8.png',
      color:Colors.redAccent

  ),
];



class topinformation {
  topinformation({
    this.index,
    this.icon,
    this.description,
    this.color
  });



  final Icon icon;
  final int index;
  final Color color;
  final String description;
  topinformation.fromJson(Map json):
        index=json["index"],
        icon=json["icon"],
  description=json["description"],
        color=json["color"];

  Map toJson()=>{"index":index,"description":description,"color":color};
  bool selected = false;
}

//男
final List<topinformation> topinformationsman = [
  topinformation(
      description: "就业新政策,为你的就业助力",
      color:Colors.white
  ),
  topinformation(
      description: "上海万达信息招聘高薪职位",
      color:Colors.white70
  ),
  topinformation(
      description: "沪上高薪职位全新出炉,欢迎全新订阅",
      color:Colors.white30
  ),
];

//女

final List<topinformation> topinformationswoman = [
  topinformation(
      description: "就业新政策,为你的就业助力",
      color:Colors.white
  ),
  topinformation(
      description: "2019年二胎生育补贴新计划",
      color:Colors.white70
  ),
  topinformation(
      description: "孕检哪些项目是免费的",
      color:Colors.white30
  ),
];

//老

final List<topinformation> topinformationsold = [
  topinformation(
      description: "养老基金新政策，退休人员需了解",
      color:Colors.white
  ),
  topinformation(
      description: "2019居保集中登记缴费开始啦",
      color:Colors.white70
  ),
  topinformation(
      description: "养老办事指南已出，欢迎订阅",
      color:Colors.white30
  ),
];
class newsinformation {
  newsinformation({
    this.description,
    this.color,
    this.time,
    this.index,
    this.url
  });



  final Color color;
  final String description;
  final String time;
  final int index;
  final String url;
  newsinformation.fromJson(Map json):
        description=json["description"],
        color=json["color"],
         time=json["time"],
          index=json["index"],
          url=json["url"];

  Map toJson()=>{"description":description,"color":color,"index":index};
  bool selected = false;
}
///男
final List<newsinformation> newinformationsman = [
  newsinformation(
    index: 0,
      description: "首次居保缴费通知",
    time: "4天前",

  ),
  newsinformation(
    index: 1,
      description: "住房补贴预审通过",
      time: "4天前"
  ),
];

///女
final List<newsinformation> newinformationswoman = [
  newsinformation(
      index: 0,
      description: "首次居保缴费通知",
      time: "18天前"
  ),
  newsinformation(
      index: 1,
      description: "首次居保缴费通知",
      time: "18天前"
  ),
];

///老
final List<newsinformation> newinformationsold = [
  newsinformation(
      index: 0,
      description: "住房补贴已拨付",
      time: "20天前"
  ),
  newsinformation(
      index: 1,
      description: "住房补贴已拨付",
      time: "20天前"
  ),
];